package org.hry.netty.demo;

import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;

import java.nio.charset.StandardCharsets;

public class ClientChannelFutureListener implements ChannelFutureListener {
    @Override
    public void operationComplete(ChannelFuture future) throws Exception {
        if (future.isSuccess()) {
            future.channel().writeAndFlush(Unpooled.copiedBuffer("hello\n",StandardCharsets.UTF_8));
            System.out.println("---------------连接成功···············");
        } else{
            System.out.println("~~~~~~~~~~~~~~~连接失败~~~~~~~~~~~~~~~~~~");
        }
    }
}
